
** BUSINESS EXPENDITURE **

	// LONG TERM :: Stocks -- From EA

		egen bizstockraw_e = rowtotal (*rawmatvalusd_e) if p1_e5m==1 | p1_e12m ==1 | p2_e12m==1 | p3_e12m==1 | p1_e9y==1 | p2_e9y==1 | p3_e9y==1 | p1_e10y==1 | p2_e10y==1 | p3_e10y==1, m
			la var bizstockraw_e "Biz Stock: Raw Material (USD)"

		egen bizstockinvent_e = rowtotal (*mercsvalusd_e) if p1_e5m==1| p1_e12m ==1 | p3_e12m==1 | p1_e9y==1 | p2_e9y==1 | p3_e9y==1 | p1_e10y==1 | p2_e10y==1 | p3_e10y==1
			la var bizstockinvent_e "Biz Stock: Inventory   (USD)"

		egen bizstockequip_e = rowtotal (*equipvalusd_e ) if p1_e5m==1 | p1_e12m ==1 | p2_e12m==1 | p3_e12m==1 | p1_e9y==1 | p2_e9y==1 | p3_e9y==1 | p1_e10y==1 | p2_e10y==1 | p3_e10y==1, m
			la var bizstockequip_e "Biz Stock: Equipment (USD)"

		egen bizstockstruct_e = rowtotal (*structvalusd_e) if p1_e5m==1 | p1_e12m ==1 | p2_e12m==1 | p3_e12m==1 | p1_e9y==1 | p2_e9y==1 | p3_e9y==1 | p1_e10y==1 | p2_e10y==1 | p3_e10y==1, m
			la var bizstockstruct_e "Biz Stock: Structure (USD)"

		egen bizstocktot_e = rowtotal (bizstockraw_e bizstockinvent_e bizstockequip_e bizstockstruct_e) if p1_e5m==1 | p1_e12m ==1 | p2_e12m==1 | p3_e12m==1 | p1_e9y==1 | p2_e9y==1 | p3_e9y==1 | p1_e10y==1 | p2_e10y==1 | p3_e10y==1
			la var bizstocktot_e "Business Stock (USD)"

		* Capped
		sum bizstocktot_e, d
		gen bizstocktotp99_e = cond(bizstocktot_e>r(p99), r(p99), bizstocktot_e)  if bizstocktot_e!=.
		la var bizstocktotp99_e "Business Stock (USD) Capped 99th"


		gen bizstockfixedcost_e = .

	// SHORT TERM :: Flows -- from the EA for phase 2 and 3 and outside the table for phase 1

		egen bizexpraw_e = rowtotal(shop2wmaterialsamtusd_e table2wmaterialsamtusd_e buysell2wmaterialsamtusd_e pettytrade2wmaterialsamtusd_e trade2wmaterialsamtusd_e office2wmaterialsamtusd_e carload2wmaterialsamtusd_e carwash2wmaterialsamtusd_e moto2wmaterialsamtusd_e carryload2wmaterialsamtusd_e guard2wmaterialsamtusd_e houseclswp2wmaterialsamtusd_e scavenge2wmaterialsamtusd_e beg2wmaterialsamtusd_e farm2wmaterialsamtusd_e drugsell2wmaterialsamtusd_e  stealing2wmaterialsamtusd_e gambling2wmaterialsamtusd_e smallbiz2wmaterialsamtusd_e constr2wmaterialsamtusd_e fish2wmaterialsamtusd_e goldrubber2wmaterialsamtusd_e other2wmaterialsamtusd_e   ) if (p2_e2wks ==1 | p2_e2w2w ==1| p3_e2w==1 | p3_e5w==1)
		replace bizexpraw_e = 	materialsamtusd_e if p1_e3wks ==1
			la var bizexpraw_e "Biz Exp: Raw Material (2w USD)"

		egen bizexpinvent_e = rowtotal(shop2winventoryamtusd_e  table2winventoryamtusd_e   buysell2winventoryamtusd_e   pettytrade2winventoryamtusd_e   trade2winventoryamtusd_e   office2winventoryamtusd_e   carload2winventoryamtusd_e   carwash2winventoryamtusd_e   moto2winventoryamtusd_e   carryload2winventoryamtusd_e   guard2winventoryamtusd_e   houseclswp2winventoryamtusd_e   scavenge2winventoryamtusd_e   beg2winventoryamtusd_e   farm2winventoryamtusd_e   drugsell2winventoryamtusd_e    stealing2winventoryamtusd_e gambling2winventoryamtusd_e smallbiz2winventoryamtusd_e constr2winventoryamtusd_e fish2winventoryamtusd_e goldrubber2winventoryamtusd_e other2winventoryamtusd_e) if (p2_e2wks ==1 | p2_e2w2w ==1| p3_e2w==1 | p3_e5w==1 )
		replace bizexpinvent_e = inventoryamtusd_e if p1_e3wks ==1
			la var bizexpinvent_e "Biz Exp: Inventory (2w USD)"

		egen bizexpequip_e = rowtotal(shop2wequipmentamtusd_e table2wequipmentamtusd_e buysell2wequipmentamtusd_e pettytrade2wequipmentamtusd_e trade2wequipmentamtusd_e office2wequipmentamtusd_e carload2wequipmentamtusd_e carwash2wequipmentamtusd_e moto2wequipmentamtusd_e carryload2wequipmentamtusd_e guard2wequipmentamtusd_e houseclswp2wequipmentamtusd_e scavenge2wequipmentamtusd_e beg2wequipmentamtusd_e farm2wequipmentamtusd_e drugsell2wequipmentamtusd_e   stealing2winventoryamtusd_e gambling2winventoryamtusd_e smallbiz2winventoryamtusd_e constr2winventoryamtusd_e fish2winventoryamtusd_e goldrubber2winventoryamtusd_e other2winventoryamtusd_e) if (p2_e2wks ==1 | p2_e2w2w ==1| p3_e2w==1 | p3_e5w==1)
		egen temp = rowtotal (equipmentamtusd_e equipmentothamtusd_e)
		replace bizexpequip_e = temp if p1_e3wks ==1
		drop temp
			la var bizexpequip_e "Biz Exp: Equipment (2w USD)"

		egen bizexpstruct_e = rowtotal(shop2wbizstructamtusd_e table2wbizstructamtusd_e buysell2wbizstructamtusd_e pettytrade2wbizstructamtusd_e trade2wbizstructamtusd_e office2wbizstructamtusd_e carload2wbizstructamtusd_e carwash2wbizstructamtusd_e moto2wbizstructamtusd_e carryload2wbizstructamtusd_e guard2wbizstructamtusd_e houseclswp2wbizstructamtusd_e scavenge2wbizstructamtusd_e beg2wbizstructamtusd_e farm2wbizstructamtusd_e drugsell2wbizstructamtusd_e  stealing2winventoryamtusd_e gambling2winventoryamtusd_e smallbiz2winventoryamtusd_e constr2winventoryamtusd_e fish2winventoryamtusd_e goldrubber2winventoryamtusd_e other2winventoryamtusd_e) if (p2_e2wks ==1 | p2_e2w2w ==1| p3_e2w==1 | p3_e5w==1)
		* We don't have that at phase 1
		replace bizexpstruct_e = bizstructamtusd_e if p1_e3wks ==1
			la var bizexpstruct_e "Biz Exp: Structure (2w USD)"

		* At phase 1, we only have rent and storage
		egen bizexpfixedcost_e = rowtotal(bizrentamtusd_e bizstorageamtusd_e  bizfeesamtusd_e bizsectyamtusd_e bizemployeesamtusd_e bizcorruptionamtusd_e  biztransportamtusd_e bizotheramtusd_e) if  (p1_e3wks ==1 | p2_e2wks ==1 | p2_e2w2w ==1| p3_e2w==1 | p3_e5w==1)
			la var bizexpfixedcost_e "Biz Exp: Fixed Cost (3w/2w USD)"

		egen bizexptot_e = rowtotal (bizexpraw_e bizexpinvent_e bizexpequip_e bizexpstruct_e bizexpfixedcost_e) if (p1_e3wks ==1 | p2_e2wks ==1 | p2_e2w2w ==1| p3_e2w==1 | p3_e5w==1), m
			la var bizexptot_e "Business investment in past 2w (USD)"

		* Capped
		sum bizexptot_e, d
		gen bizexptotp99_e = cond(bizexptot_e>r(p99), r(p99), bizexptot_e)  if bizexptot_e!=.
		la var bizexptotp99_e "Business investment in past 2w (USD) Capped"
